<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .box1{
        width: 600px;
        height: 400px;
        border: 10px solid #f00;
        margin: 50px auto;
    }
    .box1 p{
      width: 400px;
      height: 200px;
      margin: 100px auto;
      background-color: pink;
    }

    
    .box2{
      position:relative;
      width: 600px;
      height: 400px;
      border: 10px solid #f00;
      margin: 50px auto;
    }
    .box2 p{
      position: absolute;
      width: 400px;
      height: 200px;
      left: 50%;
      margin-left: -200px;
      margin-top: 100px;
      background-color: pink;
    }
  </style>
</head>
<body>
  <div class="box1">
    <p></p>
  </div>

  <div class="box2">
    <p></p>
  </div>
</body>
</html>